import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    docCtlList = '/docCtl/list',
    docCtlCreate = '/docCtl/create',
    docCtlDelete = '/docCtl/delete',
    docCtlUpdate = '/docCtl/update',
    docCtlInTemp = '/docCtl/intemp',
    docCtlUpdateTemp = '/docCtl/updatetemp'
}

/**
 * @description: 修改
 */
export function docCtlUpdate(params: any) {
    return http.request({
        url: Api.docCtlUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function docCtlDelete(params: any, option: any) {
    return http.request({
        url: Api.docCtlDelete,
        method: 'POST',
        params,
    },{
        ...option,
        isTransformRequestResult: false,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function docCtlCreate(params: any) {
    return http.request({
        url: Api.docCtlCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function docCtlList(params: any) {
    return http.request({
        url: Api.docCtlList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}

export function docCtlInTemp(tempid: number){
    return http.request({
        url: Api.docCtlInTemp,
        method: 'POST',
        params: {"tempid":tempid, "type":0},
    })
}

export function outDocCtlInTemp(tempid: number){
    return http.request({
        url: Api.docCtlInTemp,
        method: 'POST',
        params: {"tempid":tempid, "type":1},
    })
}

export function docCtlUpdateTemp(params: any){
    return http.request({
        url: Api.docCtlUpdateTemp,
        method: "POST",
        params,
    })
}
